package com.ruoyi.pay.manager.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.pay.manager.domain.PayManagerService;
import com.ruoyi.pay.manager.service.IPayManagerServiceService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 订单-单个商品服务信息Controller
 * 
 * @author 王强
 * @date 2023-12-22
 */
@RestController
@RequestMapping("/pay/service")
public class PayManagerServiceController extends BaseController
{
    @Autowired
    private IPayManagerServiceService payManagerServiceService;

    /**
     * 查询订单-单个商品服务信息列表
     */
    @PreAuthorize("@ss.hasPermi('pay:service:list')")
    @GetMapping("/list")
    public TableDataInfo list(PayManagerService payManagerService)
    {
        startPage();
        List<PayManagerService> list = payManagerServiceService.selectList(payManagerService);
        return getDataTable(list);
    }

    /**
     * 导出订单-单个商品服务信息列表
     */
    @PreAuthorize("@ss.hasPermi('pay:service:export')")
    @Log(title = "订单-单个商品服务信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PayManagerService payManagerService)
    {
        List<PayManagerService> list = payManagerServiceService.selectList(payManagerService);
        ExcelUtil<PayManagerService> util = new ExcelUtil<PayManagerService>(PayManagerService.class);
        util.exportExcel(response, list, "订单-单个商品服务信息数据");
    }

    /**
     * 获取订单-单个商品服务信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('pay:service:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return success(payManagerServiceService.selectById(id));
    }

    /**
     * 新增订单-单个商品服务信息
     */
    @PreAuthorize("@ss.hasPermi('pay:service:add')")
    @Log(title = "订单-单个商品服务信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PayManagerService payManagerService)
    {
        return toAjax(payManagerServiceService.insert(payManagerService));
    }

    /**
     * 修改订单-单个商品服务信息
     */
    @PreAuthorize("@ss.hasPermi('pay:service:edit')")
    @Log(title = "订单-单个商品服务信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PayManagerService payManagerService)
    {
        return toAjax(payManagerServiceService.update(payManagerService));
    }

    /**
     * 删除订单-单个商品服务信息
     */
    @PreAuthorize("@ss.hasPermi('pay:service:remove')")
    @Log(title = "订单-单个商品服务信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids)
    {
        return toAjax(payManagerServiceService.deleteByIds(ids));
    }
}
